<extend name="Public/base"/>

<block name="body">
<link rel="stylesheet" type="text/css" href="__CSS__/store.css?15031711">
<form action="{:U('',array('member_id'=>$member_id))}" method="post" class="form-horizontal">
  <table border="0" cellpadding="0" cellspacing="0" class="store-joinin">
    <thead>
      <tr>
        <th colspan="20">公司及联系人信息</th>
      </tr>
    </thead>
    <tbody>
      <tr style="background: rgb(255, 255, 255);">
        <th class="w150">公司名称：</th>
        <td colspan="20">{$data.store_name}</td>
      </tr>
      <tr style="background: rgb(255, 255, 255);">
        <th>公司所在地：</th>
        <td><input type="text" name="company_address" value="{$data.company_address}"></td>
        <th>公司详细地址：</th>
        <td colspan="20"><input type="text" name="company_address_detail" value="{$data.company_address_detail}"></td>
      </tr>
      <tr style="background: rgb(255, 255, 255);">
        <th>公司电话：</th>
        <td><input type="text" name="company_phone" value="{$data.company_phone}"></td>
        <th>员工总数：</th>
        <td><input type="text" name="company_employee_count" value="{$data.company_employee_count}">&nbsp;人</td>
        <th>注册资金：</th>
        <td><input type="text" name="company_registered_capital" value="{$data.company_registered_capital}">&nbsp;万元 </td>
      </tr>
      <tr style="background: rgb(251, 251, 251);">
        <th>联系人姓名：</th>
        <td><input type="text" name="contacts_name" value="{$data.contacts_name}"></td>
        <th>联系人电话：</th>
        <td><input type="text" name="contacts_phone" value="{$data.contacts_phone}"></td>
        <th>电子邮箱：</th>
        <td><input type="text" name="contacts_email" value="{$data.contacts_email}"></td>
      </tr>
    </tbody>
  </table>
  
  <table border="0" cellpadding="0" cellspacing="0" class="store-joinin">
    <thead>
      <tr>
        <th colspan="20">营业执照信息（副本）</th>
      </tr>
    </thead>
    <tbody>
      <tr style="background: rgb(255, 255, 255);">
        <th class="w150">营业执照号：</th>
        <td><input type="text" name="business_licence_number" value="{$data.business_licence_number}"></td></tr><tr style="background: rgb(255, 255, 255);">
      
        <th>营业执照所在地：</th>
        <td><input type="text" name="business_licence_address" value="{$data.business_licence_address}"></td></tr><tr style="background: rgb(255, 255, 255);">
      
        <th>营业执照有效期：</th>
       <td>
          <input type="text" name="business_licence_start" class="search-input w-100 date_select" value="{$data.business_licence_start|date='Y-m-d',###}" placeholder="开始"/>
          <input type="text" name="business_licence_end" class="search-input w-100 date_select" value="{$data.business_licence_end|date='Y-m-d',###}" placeholder="结束"/>
       </td>
      </tr>
      <tr style="background: rgb(255, 255, 255);">
        <th>法定经营范围：</th>
        <td colspan="20"><input type="text" name="business_sphere" value="{$data.business_sphere}"></td>
      </tr>
      <tr style="">
        <th>营业执照号<br>电子版：</th>
        <td colspan="20">{:hook('uploadImages', array('name' => 'business_licence_number_electronic', 'tpl' => 'baidu/img', 'value' => $data['business_licence_number_electronic']))}</td>
      </tr>
    </tbody>
  </table>
  
  <table border="0" cellpadding="0" cellspacing="0" class="store-joinin">
    <thead>
      <tr>
        <th colspan="20">组织机构代码证</th>
      </tr>
    </thead>
    <tbody>
      <tr style="background: rgb(255, 255, 255);">
        <th>组织机构代码：</th>
        <td colspan="20"><input type="text" name="organization_code" value="{$data.organization_code}"></td>
      </tr>
      <tr style="background: rgb(255, 255, 255);">
        <th>组织机构代码证<br>          电子版：</th>
        <td colspan="20">{:hook('uploadImages', array('name' => 'organization_code_electronic', 'tpl' => 'baidu/img', 'value' => $data['organization_code_electronic']))}</td>
      </tr>
    </tbody>
  </table>
  
  <table border="0" cellpadding="0" cellspacing="0" class="store-joinin">
    <thead>
      <tr>
        <th colspan="20">一般纳税人证明：</th>
      </tr>
    </thead>
    <tbody>
      <tr style="background: rgb(255, 255, 255);">
        <th>一般纳税人证明：</th>
        <td colspan="20">{:hook('uploadImages', array('name' => 'general_taxpayer', 'tpl' => 'baidu/img', 'value' => $data['general_taxpayer']))}</td>
      </tr>
    </tbody>
  </table>
  
  <table border="0" cellpadding="0" cellspacing="0" class="store-joinin">
    <thead>
      <tr>
        <th colspan="20">开户银行信息：</th>
      </tr>
    </thead>
    <tbody>
      <tr style="background: rgb(255, 255, 255);">
        <th class="w150">银行开户名：</th>
        <td><input type="text" name="bank_account_name" value="{$data.bank_account_name}"></td>
      </tr><tr style="background: rgb(255, 255, 255);">
        <th>公司银行账号：</th>
        <td><input type="text" name="bank_account_number" value="{$data.bank_account_number}"></td></tr>
      <tr>
        <th>开户银行支行名称：</th>
        <td><input type="text" name="bank_name" value="{$data.bank_name}"></td>
      </tr>
      <tr style="background: rgb(255, 255, 255);">
        <th>支行联行号：</th>
        <td>{$data.bank_code}</td>
      </tr><tr style="background: rgb(255, 255, 255);">
        <th>开户银行所在地：</th>
        <td colspan="20"><input type="text" name="bank_address" value="{$data.bank_address}"></td>
      </tr>
      <tr style="background: rgb(255, 255, 255);">
        <th>开户银行许可证<br>电子版：</th>
        <td colspan="20">{:hook('uploadImages', array('name' => 'bank_licence_electronic', 'tpl' => 'baidu/img', 'value' => $data['bank_licence_electronic']))}</td>
      </tr>
    </tbody>
    
  </table>
  
  <table border="0" cellpadding="0" cellspacing="0" class="store-joinin">
    <thead>
      <tr>
        <th colspan="20">结算账号信息：</th>
      </tr>
    </thead>
    <tbody>
      <tr style="background: rgb(255, 255, 255);">
        <th class="w150">银行开户名：</th>
        <td><input type="text" name="settlement_bank_account_name" value="{$data.settlement_bank_account_name}"></td>
      </tr>
      <tr style="background: rgb(255, 255, 255);">
        <th>公司银行账号：</th>
        <td><input type="text" name="settlement_bank_account_number" value="{$data.settlement_bank_account_number}"></td>
      </tr>
      <tr style="background: rgb(255, 255, 255);">
        <th>开户银行支行名称：</th>
        <td><input type="text" name="settlement_bank_name" value="{$data.settlement_bank_name}"></td>
      </tr>
      <tr style="background: rgb(255, 255, 255);">
        <th>支行联行号：</th>
        <td><input type="text" name="settlement_bank_code" value="{$data.settlement_bank_code}"></td>
      </tr>
      <tr style="background: rgb(255, 255, 255);">
        <th>开户银行所在地：</th>
        <td><input type="text" name="bank_address" value="{$data.bank_address}"></td>
      </tr>
    </tbody>
    
  </table>
  
  <table border="0" cellpadding="0" cellspacing="0" class="store-joinin">
    <thead>
      <tr>
        <th colspan="20">税务登记证</th>
      </tr>
    </thead>
    <tbody>
      <tr style="background: rgb(255, 255, 255);">
        <th class="w150">税务登记证号：</th>
        <td><input type="text" name="tax_registration_certificate" value="{$data.tax_registration_certificate}"></td>
      </tr>
      <tr style="background: rgb(255, 255, 255);">
        <th>纳税人识别号：</th>
        <td><input type="text" name="taxpayer_id" value="{$data.taxpayer_id}"></td>
      </tr>
      <tr style="background: rgb(255, 255, 255);">
        <th>税务登记证号<br>电子版：</th>
        <td>{:hook('uploadImages', array('name' => 'tax_registration_certificate_electronic', 'tpl' => 'baidu/img', 'value' => $data['tax_registration_certificate_electronic']))}</td>
      </tr>
    </tbody>
  </table>
  

  <table border="0" cellpadding="0" cellspacing="0" class="store-joinin">
      <thead>
        <tr>
          <th colspan="20">店铺经营信息</th>
        </tr>
      </thead>
      <tbody>
        <tr style="background: rgb(255, 255, 255);">
          <th class="w150">卖家帐号：</th>
          <td>{$data.seller_name}</td>
        </tr>
        <tr style="background: rgb(255, 255, 255);">
          <th class="w150">店铺名称：</th>
          <td><input type="text" name="store_name" value="{$data.store_name}"></td>
        </tr>
        <tr style="background: rgb(255, 255, 255);">
          <th>店铺等级：</th>
          <td>{$data.grade_name}</td>
        </tr>
        <tr style="background: rgb(255, 255, 255);">
          <th>经营类目：</th>
          <td colspan="2">
          <table border="0" cellpadding="0" cellspacing="0" id="table_category" class="type">
              <thead>
                <tr style="background: rgb(255, 255, 255);">
                  <th>分类1</th>
                  <th>分类2</th>
                  <th>分类3</th>
                  <!-- <th>佣金比例</th> -->
                </tr>
              </thead>
              <tbody>
              <volist name="data.sell_cate" id="vo">
                  <tr style="background: rgb(255, 255, 255);">
                      <td>{$vo[0]}</td>
                      <td>{$vo[1]}</td>
                      <td>{$vo[2]}</td>
                   <!--    <eq name="data.status" value="1">
                          <td><input nctype="rate" name="rate[]" value="" />%</td>
                      <else />
                          <td>{$data['class_rate'][$key]}</td>
                      </eq> -->
                  </tr>
              </volist>
              </tbody>
            </table>
          </td>
        </tr>
        <switch name="data.status">
        
        <case value="1">
            <!-- 等待审核 -->
            <tr style="background: rgb(255, 255, 255);">
                <th>审核意见：</th>
                <td><textarea id="message_1" name="joinin_message"></textarea></td>
            </tr>
        </case>
        
        <case value="3">
            <!-- 审核失败 -->
            <tr style="background: rgb(255, 255, 255);">
                <th>审核意见：</th>
                <td>{$data.joinin_message}</td>
            </tr>
        </case>
        
        <case value="4">
            <!-- 已缴费，等待审核 -->
            <tr style="background: rgb(251, 251, 251);">
            <th>付款凭证：</th>
            <td><a nctype="nyroModal" href="{:get_cover($data.paying_money_certificate)}"> <img src="{:get_cover($data.paying_money_certificate)}" alt=""> </a></td>
            </tr>
            <tr style="background: rgb(255, 255, 255);">
            <th>审核意见：</th>
            <td><textarea id="message_4" name="paying_money_certificate_explain"></textarea></td>
            </tr>
        </case>
        
        <case value="5">
            <!-- 缴费审核失败 -->
            <tr style="background: rgb(251, 251, 251);">
            <th>付款凭证：</th>
            <td><a nctype="nyroModal" href="{:get_cover($data.paying_money_certificate)}"> <img src="{:get_cover($data.paying_money_certificate)}" alt=""> </a></td>
            </tr>
            <tr style="background: rgb(255, 255, 255);">
            <th>付款凭证说明：</th>
            <td>{$data.paying_money_certificate_explain}</td>
            </tr>
            
        </case>
        
        <case value="6">
            <!-- 缴费审核成功，已开店 -->
            <!--<tr style="background: rgb(251, 251, 251);">
            <th>付款凭证：</th>
            <td><a nctype="nyroModal" href="{:get_cover($data.paying_money_certificate)}"> <img src="{:get_cover($data.paying_money_certificate)}" alt=""> </a></td>
            </tr>
            <tr style="background: rgb(255, 255, 255);">
            <th>付款凭证说明：</th>
            <td>{$data.paying_money_certificate_explain}</td>
            </tr>
            <tr style="background: rgb(255, 255, 255);">
                <th>审核意见：</th>
                <td>{$data.joinin_message}</td>
            </tr>-->
        </case>
        </switch>
      </tbody>
    </table>
  <table border="0" cellpadding="0" cellspacing="0" class="store-joinin">
    <thead>
      <tr>
        <th colspan="20">佣金 </th>
      </tr>
    </thead>
    <tbody>
   <tr style="background: rgb(255, 255, 255);">
            <th>佣金比例：</th>
            <td>
            <if condition='$data["rate"]'>
            {$data.rate}
            <else />
            <input type="text" name='rate' value="{$data.rate|default=1}" />
            </if>%
            </td>
            </tr>
    </tbody>
  </table>
<input type="hidden" name="id" value="{$data.id}">
</form>
  <div>
    <in name="data.status" value="1,4">
        <button class="btn submit-btn" id="J_reject">拒绝</button>
        <button class="btn btn-return" id="J_pass">通过</button>
    <else />
        <a href="javascript:history.go(-1);" class="btn btn-return">返 回</a>
        <button type="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">确定</button>
    </in>
  </div>
</block>

<block name="script">
  <script type="text/javascript">
    //导航高亮
    highlight_subnav("{:U('Store/apply')}");
    var status = "{$data['status']}";
    var member_id = "{$data['member_id']}";
    $(function(){
        $('#J_reject').click(function(){
            var content = $('#message_'+status).val();
            var _this = $(this);
            if(content == ''){
                updateAlert('请填写拒绝理由！');
                return false;
            }
            UI.confirm('确定拒绝申请？', function(){
                _this.addClass('disabled').attr('autocomplete', 'off').prop('disabled', true);
                $.post("{:U('Store/applyVerify')}",{verify_type:'fail',joinin_message:content,member_id:member_id},function(data){
                    //alert(data.status);
                    if(data.status === 1){
                        if(data.url){
                          updateAlert(data.info + ' 页面即将自动跳转~6', 'alert-success');
                        }else{
                          updateAlert(data.info, 'alert-success');
                        }
                        setTimeout(function(){
                          _this.removeClass('disabled').prop('disabled', false);
                          if(data.url){
                            location.href = data.url;
                          }else if($(that).hasClass('no-refresh')){
                            $('#top-alert').find('button').click();
                          }else{
                            location.reload();
                          }
                        }, 1500);
                      }else{
                        updateAlert(data.info);
                        setTimeout(function(){
                          _this.removeClass('disabled').prop('disabled', false);
                          if(data.url){
                            location.href = data.url;
                          }else{
                            $('#top-alert').find('button').click();
                          }
                        }, 1500);
                      }
                },'json');
            });
            
            
        });
        
        // 通过
        $('#J_pass').click(function(){
            var content = $('#message_'+status).val();
            var _this = $(this);
            var rate = $('input[name="rate"]').val();
            if(rate == '' || rate == null){
               updateAlert('请填写分佣比例！');
                return false;
            }
            var valid = true;
            $('[nctype="rate"]').each(function(commis_rate) {
                rate = $(this).val();
                if(rate == '') {
                    valid = false;
                    return false;
                }

                var rate = Number($(this).val());
                if(isNaN(rate) || rate < 0 || rate >= 100) {
                    valid = false;
                    return false;
                }
            });
            
            if(valid) {
                UI.confirm('确定审核通过？', function(){
                    var data = $('form').serialize();
                    data += '&verify_type=success&member_id='+member_id;
                    _this.addClass('disabled').attr('autocomplete', 'off').prop('disabled', true);
                    $.post("{:U('Store/applyVerify')}",data,function(data){
                        if(data.status === 1){
                            if(data.url){
                              updateAlert(data.info + ' 页面即将自动跳转~8', 'alert-success');
                            }else{
                              updateAlert(data.info, 'alert-success');
                            }
                            setTimeout(function(){
                              _this.removeClass('disabled').prop('disabled', false);
                              if(data.url){
                                location.href = data.url;
                              }else if($(that).hasClass('no-refresh')){
                                $('#top-alert').find('button').click();
                              }else{
                                location.reload();
                              }
                            }, 1500);
                          }else{
                            updateAlert(data.info);
                            setTimeout(function(){
                              _this.removeClass('disabled').prop('disabled', false);
                              if(data.url){
                                location.href = data.url;
                              }else{
                                $('#top-alert').find('button').click();
                              }
                            }, 1500);
                          }
                    },'json');
                });
                
            } else {
                updateAlert('请正确填写分佣比例！');
                return false;
            }
            
            
        });
        

    });
    //时间选择
    $('.date_select').focus(function(){
        WdatePicker({skin: 'twoer', dateFmt: 'yyyy-MM-dd', maxDate: '%y-%M-%d'});
    });
  </script>
  <script src="__PUBLIC__/Admin/js/My97Date/WdatePicker.js"></script>
</block>
